<?php

namespace app\manage\services;

use app\common\loader\ModelMerchant;
use app\common\traits\RechargeTrait;
use think\Exception;

/**
 * 商户充值管理
 */
class RechargeService extends BaseService
{


    use RechargeTrait;

    /**
     * 支付详情
     * @param string $payOrder 支付订单号
     * @return mixed
     */
    public function info(string $payOrder)
    {

        return [];
    }

    /**
     * 线下支付
     * @param string $payOrder 支付订单号
     * @param float  $realMoney 支付金额
     * @param int    $opUser 操作人
     * @param string $memo 备注
     * @return mixed
     * @throws \think\Exception
     */
    public function offline_pay(string $payOrder, float $realMoney, int $opUser, string $memo = '')
    {
        $result = ModelMerchant::RechargeLog()->offlinePay($payOrder, $realMoney, $opUser, $memo);

        if (!$result) {
            throw new  Exception('支付失败', API_ERROR);
        }

        return $result;

    }
}